﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Ext.Net;
using Ext.Net.MVC;
using SDSystem.Models;

namespace SDSystem.Controllers
{
    public class TopicController : Controller
    {
        //
        // GET: /Topic/
        private ForumEntities db=new ForumEntities();
        public ActionResult Index()
        {
            return View();
        }

        public ActionResult ListTopic(StoreRequestParameters parameters)
        {
            var listTopicDate = from table1 in db.Topics
                                join table2 in db.Fora on table1.ForumId equals table2.ForumId
                                join table3 in db.Members on table1.MemberId equals table3.MemberId
                                select new
                                           {
                                               table1.TopicId,
                                               table2.ForumName,
                                               table1.Description,
                                               table1.DateCreate,
                                               table3.MemberName,
                                               table1.IsActive

                                           };
            return this.Store(listTopicDate);
        }
    }
}
